from my_base_service import *
from datetime import date
import uuid

today = date.today()

llm = get_model()

messages = [
    SystemMessage(content="你是AGIClass的课程助理。"),
]

handler = CallbackHandler(
    user_id="wzr",
    session_id="my_chat_session " + today.strftime("%B %d, %Y")
)

while True:
    user_input = input("User: ")
    if user_input.strip() == "":
        break
    # 讲用户问题添加到历史信息中
    messages.append(HumanMessage(content=user_input))
    # 执行 AI
    # response = llm.invoke(messages)
    response = llm.invoke(messages, config={"callbacks": [handler]})
    print("AI: "+response.content)
    # 讲AI 回答问题添加到历史信息中
    messages.append(response)
